package bdz.projects.inl.vo
{
	import bdz.projects.inl.core.CoreVO;

	public class ProductVO extends CoreVO
	{
		public var product_id:String;
		public var product_name:String;
		public var product_code:String;
		public var product_ip_rating:String;
		public var product_recess_depth:String;
		public var product_datasheet:String;
		public var product_photometric_file:String;
		public var product_installation:String;
		public var product_date:Date;
		public var product_hero_image:String;
		public var product_hero_thumb:String;
		public var product_featured:String;
		public var finishes:Array = new Array();
		public var control_gears:Array = new Array();
		
		public var light_sources:Array = new Array();
		public var manufacturers:Array = new Array();
		
		public var types:Array = new Array();
		
		
		public function ProductVO(def:XML = null){
			idField = "product_id";
			linkPairs = [
						{tree:"product_manufacturers", node:"inl_product_manufacturers", arr:"manufacturers", vo:ProductManufacturerVO},
						{tree:"product_types", node:"inl_product_types", arr:"types", vo:ProductTypeVO},
						{tree:"product_finishes", node:"inl_product_finishes", arr:"finishes", vo:ProductFinishVO},
						{tree:"product_control_gears", node:"inl_product_control_gears", arr:"control_gears", vo:ProductControlGearVO},
						{tree:"product_light_sources", node:"inl_product_light_sources", arr:"light_sources", vo:ProductLightSourceVO}
						];
			if(def && def.name() != "inl_products"){
				def = def.inl_products[0];	
			}
			propList = ["product_id", "product_name", "product_code", "product_ip_rating", "product_recess_depth", "product_datasheet", "product_photometric_file", "product_installation", "product_date", "product_hero_image", "product_hero_thumb", "product_featured"];
			super(def, ProductMediaVO, "inl_products");
			
		}
		override protected function createPropertyAttributes():void{
			propAttributes = [
			{name:"product_name", type:"input", label:"Name"},
			{name:"product_code", type:"input", label:"Code"},
			{name:"product_ip_rating", type:"input", label:"IP Rating"},
			{name:"product_recess_depth", type:"input", label:"Recess Depth"},
			{name:"product_datasheet", type:"file", label:"Datasheet"},
			{name:"product_photometric_file", type:"file", label:"Photometric File"},
			{name:"product_installation", type:"file", label:"Installation"},
			{name:"product_date", type:"date", label:"Date"},
			{name:"product_hero_image", type:"image", label:"Hero Image"},
			{name:"product_hero_thumb", type:"image", label:"Hero Thumbnail"},
			{name:"product_featured", type:"toggle", label:"Set as featured"},
			{name:"relations", type:"dependency_list", vo:ProductMediaVO, label:"Media", list:"media", labelField:"media_link", idField:"product_media_id"},
			{name:"manufacturers", type:"dependency_list", vo:ProductManufacturerVO, label:"Manufacturers", list:"lookup", labelField:"type", idField:"product_manufacturers_id"},
			{name:"types", type:"dependency_list", vo:ProductTypeVO, label:"Types", list:"lookup", labelField:"type", idField:"product_types_id"},
			{name:"finishes", type:"dependency_list", vo:ProductFinishVO, label:"Finishes", list:"lookup", labelField:"type", idField:"product_finishes_id" },
			{name:"control_gears", type:"dependency_list", vo:ProductControlGearVO, label:"Control Gears", list:"lookup", labelField:"type", idField:"product_control_gears_id"},
			{name:"light_sources", type:"dependency_list", vo:ProductLightSourceVO, label:"Light Sources", list:"lookup", labelField:"type", idField:"product_light_sources_id"}
			];
		}
		
		
	}
}